﻿using Newtonsoft.Json;
using SHBSWater.OutApi.Net452.Helpers;
using SHBSWater.OutApi.Net452.Models;
using SHBSWater.OutApi.Net452.YWTBWebService;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace SHBSWater.OutApi.Net452.Controllers
{
    [RoutePrefix("ywtb")]
    public class YTWBController : ApiController
    {

        public YTWBController()
        { 
        }

        [Route("PushData")]
        public IHttpActionResult DashboardApprovalPush(DashboardApprovalPushRequestDto dto)
        {
            try
            {
                Log4NetHelper.WriteLog("DashboardApprovalPush request dto: " + JsonConvert.SerializeObject(dto));
                YWTB_WSSoapClient client = new YWTB_WSSoapClient();
                var res = client.querybjxx(dto.incidentId, dto.applyNo, dto.businessType, dto.userId);
                DashboardApprovalPushResponseDto response = new DashboardApprovalPushResponseDto()
                {
                    Success = res.code == 200,
                    Code = res.code
                };
                return Ok(response);
            }
            catch (Exception ex)
            {
                Log4NetHelper.WriteLog("发生异常", ex);
                DashboardApprovalPushResponseDto response = new DashboardApprovalPushResponseDto()
                {
                    Success = true,
                    Code = 200
                };
                return Ok();
            }
        }


    }
}
